package 设计模式.创建型.工厂模式;

import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import 设计模式.创建型.工厂模式.config.ScheduleClassBeanFactory;
import 设计模式.创建型.工厂模式.sc.ScheduleClass;
import 设计模式.行为模式.模板模式.Result;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;

/**
 * @author lchenglong
 * @date 2024/1/26
 */
@RestController
@RequestMapping("/schedule")
public class ScheduleClassController {
    @Resource
    private ScheduleClassBeanFactory scheduleClassBeanFactory;

    @RequestMapping(value = "scheduleClass")
    public Result scheduleClass(HttpServletRequest request,String scheduleType){
        ScheduleClass scheduleClass = scheduleClassBeanFactory.getSchedule(scheduleType);
        return  scheduleClass.scheduleClass(request);
    }
}
